<!--
 * @Author: zhangxiangsheng 1026583651@qq.com
 * @Date: 2024-06-18 13:57:45
 * @LastEditors: zhangxiangsheng 1026583651@qq.com
 * @LastEditTime: 2024-06-19 09:55:47
 * @FilePath: \appGly\pages\Station\Stationadd.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <view>
    <u-navbar title="站点添加"></u-navbar>
    <formz ref="formz" :inputs="inputs"></formz>
    <fixedbtn>
      <u-button type="primary" @click="save" :loading="loading">
        {{ $z.$t("添加站点") }}
      </u-button>
    </fixedbtn>
  </view>
</template>

<script>
  import json from "./Stationaddjson.js";
  export default {
    data() {
      return {
        inputs: json.addjson,
        loading: false,
      };
    },
    mounted() {
      this.init();
    },
    methods: {
      async init() {
        await this.$store.dispatch("user/getuser");
      },
      async save() {
        let data = await this.$refs.formz.validate();
        data.b_car = "1";
        this.loading = true;
        let par = await this.$z.request("/Stationadd", data);
        await new Promise((resolve) => {
          setTimeout(async () => {
            await this.$z.request("/StationCaredt", {
              ...data,
              id: par[0].id,
            });
            resolve("");
          }, 500);
        });
        this.loading = false;
        this.$z.back();
      },
    },
  };
</script>

<style></style>
